package com.ywz.common.exception;

import com.ywz.common.ResultResp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 类描述 -> 全局异常处理类
 *
 * @Author: ywz
 * @Date: 2025/03/24
 */
@RestControllerAdvice
@Slf4j
public class MyExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public ResultResp exceptionHandler(Exception e) {
        log.error("异常信息：", e);
        return ResultResp.error(e.getMessage());
    }
}
